#ifndef CHARGING_PILE_IO_H
#define CHARGING_PILE_IO_H

#include "chargingmodel.h"
#include <QThread>
/**
 * @brief The Charging_Pile_IO class
 * 科星充电桩IO控制起模块
 */
class Charging_Pile_IO : public ChargingModel {

public:
    explicit Charging_Pile_IO( QObject* parent = nullptr );
    ~Charging_Pile_IO();
    bool chargingOpen() override;
    bool chargingClose() override;
    bool chargingStop() override;

public slots:
    void sltTimeOut() override;

    void onTcpReadyRead() override;

private:
    uint8_t state_in[ 9 ] = { 0xCC, 0xDD, 0xC0, 0x01, 0x00, 0x00, 0x0D, 0xCE, 0x9C };  //读取输入通道1，通道2状态 ,EE FF C0 01 00 02 0D D0 A0 通道1关2慨，EE FF C0 01 00 01 0D CF 9E 通道1开，2关
    uint8_t state_out[ 9 ]   = { 0xCC, 0xDD, 0xB0, 0x01, 0x00, 0x00, 0x0D, 0xBE, 0x7C };                                      //读取输出通道1，通道2状态,AABBB00100000DBE通道1关，2关，
    uint8_t open_data[ 15 ]  = { 0xCC, 0xDD, 0xA2, 0x01, 0x02, 0x01, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xA9, 0x52 };  // 4F4B21 打开报文写入两个输出通道：通道1开，通道2关
    uint8_t close_data[ 15 ] = { 0xCC, 0xDD, 0xA2, 0x01, 0x02, 0x01, 0x00, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, 0xA9, 0x52 };  // 4F4B21 关闭报文写入两个输出通道：通道2开，通道1关
    uint8_t close_all_data[ 15 ] = { 0xCC, 0xDD, 0xA2, 0x01, 0x02, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xA8, 0x50 };  // 4F4B21 关闭报文写入两个输出通道：通道2开，通道1关
    bool setOut( uint8_t data[], int type );
};

#endif  // CHARGING_PILE_IO_H
